/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.click.app.dao.hibernate;

import com.click.app.dao.EmployeeDao;
import com.click.app.model.Employee;
import java.util.List;

/**
 *
 * @author ariel
 */
public class EmployeeDaoHibernate extends GenericDaoHibernate<Employee, Long> implements EmployeeDao {

    public EmployeeDaoHibernate() {
        super(Employee.class);
    }

    public List<Employee> findByType(String type) {
        return getHibernateTemplate().find("from Employee where type=?", type);
    }

    public List<Employee> findByRole(String type) {
        return getHibernateTemplate().find("from Employee employee inner join fetch employee.roles as rol where rol.name=?", type);
    }
}
